package com.gx.movie.controller.consumer;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.gx.movie.consumer.service.OrderConsumerService;
import com.gx.movie.consumer.service.UserConsumerService;

@RestController
@RequestMapping("consumer")
public class ConsumerController {

	@Resource
	private RestTemplate restTemplate;
	
	@Resource
	private UserConsumerService userConsumerService;
	@Resource
	private OrderConsumerService orderConsumerService;
	
	
	@GetMapping
	public String getNum(){
		return restTemplate.getForEntity("http://point-user/restuser/add?a=10&b=20", String.class).getBody();
	}
	
	@GetMapping("feignadd")
	public int getCousumerNum(){
		return userConsumerService.add(1, 2);
	}
	
	@GetMapping("getOrder")
	public int getOrder(){
		return orderConsumerService.getOrderId();
	}
}
